using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GNetDesktop
{
    public partial class frmMessageBoxEx : Form
    {
        private bool m_Timer;
        private int m_TimerSecond;
        private bool blnExit = false;
        public bool Timer
        {
            get
            {
                return m_Timer;
            }
            set
            {
                m_Timer = value;
                if (m_Timer)
                {
                    m_TimerSecond = 60;
                    timer1.Start();
                    
                }
                else
                {
                    timer1.Stop();
                }
            }
        }

        public frmMessageBoxEx(string Message)
        {
            InitializeComponent();

            lblMSG.Text = Message;
        }

        private void cmdCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            blnExit = true;
            this.Close();
        }

        private void cmdOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            blnExit = true;
            this.Close();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            m_TimerSecond--;
            labelTimer.Text = m_TimerSecond.ToString();

            if (m_TimerSecond <= 0)
            {
                blnExit = true;
                this.Close();
            }
        }

        private void frmMessageBoxEx_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!blnExit) e.Cancel = true;
        }

        private void frmMessageBoxEx_Load(object sender, EventArgs e)
        {

        }


    }
}